//
//  LeCubeBehaviour.cpp
//  Leste
//
//  Created by 王乐 on 2022/1/26.
//

#include "LeCubeBehaviour.h"
#include "LeRigidBody.h"
#include "LeGameObject.h"
#include "LeInput.h"

#include "GLFW/glfw3.h"

#include "LeScene.h"

LeCubeBehaviour::LeCubeBehaviour() 
{
}

LeCubeBehaviour::~LeCubeBehaviour()  {
}

void LeCubeBehaviour::FixedUpdate() {
//    if(LeInput::getKey(GLFW_KEY_SPACE) == GLFW_PRESS)
//    {
//        m_pRigidBody->m_Body->ApplyLinearImpulse(b2Vec2(0.0f, 2.0f), m_pRigidBody->m_Body->GetPosition(), true);
//    }

//    if(LeInput::getKey(GLFW_KEY_D) == GLFW_PRESS)
//    {
//        m_pGameObject->DestroyGameObject();
//    }
    if(LeInput::getMouseButton(GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS)
    {
        if(LeScene::getInstance()->getCurMouseHoverID() == m_pGameObject->ID)
        {
//            printf("Cube is selected\n");
        }
    }
}

void LeCubeBehaviour::OnContactBegin(LeGameObject *other) {
//    m_pRigidBody->m_Body->ApplyLinearImpulse(b2Vec2(2.0f, 0.0f), m_pRigidBody->m_Body->GetPosition(), true);
}

void LeCubeBehaviour::OnContactEnd(LeGameObject *other) { 
//    m_pRigidBody->m_Body->ApplyLinearImpulse(b2Vec2(0.0f, 20.0f), m_pRigidBody->m_Body->GetPosition(), true);
}


